package com.supplychainapi.service.impl;

import com.supplychainapi.common.RestResponse;
import com.supplychainapi.domain.desktop.DesktopTab;
import com.supplychainapi.domain.desktop.DesktopTabGroup;
import com.supplychainapi.service.DesktopService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class DesktopServiceImpl implements DesktopService {
    @Override
    public RestResponse tabs() {
        List<DesktopTabGroup> groups = new ArrayList<>();
        List<DesktopTab> base = new ArrayList<>();
        base.add(new DesktopTab()
                .setText("部门")
                .setAuth(true)
                .setPageId("department")
                .setAction("department")
                .setAuthId("pDepartment")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("员工")
                .setAuth(true)
                .setPageId("staff")
                .setAction("staff")
                .setAuthId("pStaff")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("供应商分类")
                .setAuth(true)
                .setPageId("treeBuild")
                .setAction("supplierCls")
                .setAuthId("pSupplierCls")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("供应商")
                .setAuth(true)
                .setPageId("supplier")
                .setAction("supplierList")
                .setAuthId("pSupplier")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("客户分类")
                .setAuth(true)
                .setPageId("treeBuild")
                .setAction("custCls")
                .setAuthId("pCustCls")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("客户")
                .setAuth(true)
                .setPageId("cust")
                .setAction("cust")
                .setAuthId("pCust")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("计量单位")
                .setAuth(true)
                .setPageId("measureUnit")
                .setAction("measureUnit")
                .setAuthId("pMeasureUnit")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("物料分类")
                .setAuth(true)
                .setPageId("treeBuild")
                .setAction("materialCls")
                .setAuthId("pMaterialCls")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("物料")
                .setAuth(true)
                .setPageId("material")
                .setAction("materialList")
                .setAuthId("pMaterial")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("使用单位")
                .setAuth(true)
                .setPageId("apply")
                .setAction("apply")
                .setAuthId("pApply")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("仓库")
                .setAuth(true)
                .setPageId("storage")
                .setAction("storage")
                .setAuthId("pStorage")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("到货地址")
                .setAuth(true)
                .setPageId("deliverAddr")
                .setAction("deliverAddr")
                .setAuthId("pDeliverAddr")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("验证异常类型")
                .setAuth(true)
                .setPageId("checkExcept")
                .setAction("checkExcept")
                .setAuthId("pCheckExcept")
                .setInitEnable(false)
        );
        base.add(new DesktopTab()
                .setText("常用清单")
                .setAuth(true)
                .setPageId("commonly")
                .setAction("commonly")
                .setAuthId("pCommonly")
                .setInitEnable(false)
        );
        groups.add(new DesktopTabGroup()
                .setText("基础资料")
                .setTabId("baseInfo")
                .setPage(base));
        List<DesktopTab> purchase = new ArrayList<>();
        purchase.add(new DesktopTab()
                .setText("购物车订货")
                .setAuth(true)
                .setPageId("cart")
                .setAction("cart")
                .setAuthId("pCart")
                .setInitEnable(false)
        );
        purchase.add(new DesktopTab()
                .setText("采购订单")
                .setAuth(true)
                .setPageId("purchaseOrder")
                .setAction("purchaseOrder")
                .setAuthId("pPurchaseOrder")
                .setInitEnable(false)
        );
        groups.add(new DesktopTabGroup()
                .setText("采购销售")
                .setTabId("purchase")
                .setPage(purchase));
        List<DesktopTab> edi = new ArrayList<>();
        edi.add(new DesktopTab()
                .setText("交易管理")
                .setAuth(true)
                .setPageId("traderManager")
                .setAction("tradeManager")
                .setAuthId("pTradeManager")
                .setInitEnable(false)
        );
        groups.add(new DesktopTabGroup()
                .setText("EDI采销")
                .setTabId("edi")
                .setPage(edi));
        List<DesktopTab> saleTrade = new ArrayList<>();
        saleTrade.add(new DesktopTab()
                .setText("销售订单")
                .setAuth(true)
                .setPageId("saleTrade")
                .setAction("saleTrade")
                .setAuthId("pSaleTrade")
                .setInitEnable(false)
        );
        groups.add(new DesktopTabGroup()
                .setText("销售订单")
                .setTabId("saleTrade")
                .setPage(saleTrade));
        List<DesktopTab> init = new ArrayList<>();
        init.add(new DesktopTab()
                .setText("公司信息")
                .setAuth(true)
                .setPageId("company")
                .setAction("company")
                .setAuthId("pShopInfo")
                .setInitEnable(false)
        );
        init.add(new DesktopTab()
                .setText("初始化")
                .setAuth(true)
                .setPageId("sysInit")
                .setAction("sysInit")
                .setAuthId("pSysInit")
                .setInitEnable(false)
        );
        groups.add(new DesktopTabGroup()
                .setText("初始设置")
                .setTabId("init")
                .setPage(init));
        return RestResponse.success(groups);
    }
}
